<template>
    <div>
      <!-- <a-button type="primary" @click="showModal">Open Modal with customized footer</a-button> -->
      <a-modal v-model:visible="visible" class="modal" :bodyStyle="{height:150+'px'}" >
        <template #footer>
          <a-button key="submit" type="primary" @click="handleOk">确定</a-button>
        </template>
        <a-row></a-row>
        <a-row>
            <a-col :span="4"></a-col>
            <a-col :span="5">
                <h3>编号：</h3>
            </a-col>
            <a-col :span="6">
                <a-input v-model:value="num" placeholder=""></a-input>
            </a-col>
        </a-row>
      </a-modal>
    </div>
</template>
<script setup>
import { ref } from 'vue';
import request from '@/utils/request'

const visible = ref(false);
const num = ref('')

const record=ref()

const emit=defineEmits(['loadData'])

// const props=defineProps(['selectedRecord'])
// const emit=defineEmits(['loadData'])

const showModal = (rec) => {
    record.value=rec
    visible.value = true;
    console.log(999999)
    console.log(record.value)
};

const handleOk = async() => {
    const result=await request({
      url:'/api/toolDetail/add',
      method:'post',
      data:{
        toolId:record.value.id,
        number:num.value
      }
    })
    console.log(record.value.id)
    console.log(result)

    //不会自动刷新
    emit('loadData')
    // console.log(result)
    visible.value = false;
    // emit('loadData')
};

defineExpose({
  showModal,
})
</script>
<style scoped>
.modal{
    height: 600px;
}
h3{
    font-weight: 900;
}
</style>
